package com.supcon.news.service.impl;

import java.util.List;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.supcon.news.bean.News;
import com.supcon.news.dao.NewsDao;
import com.supcon.news.service.NewsService;

public class NewsServiceImpl implements NewsService
{
	private NewsDao newsDao;
	public NewsDao getNewsDao()
	{
		return newsDao;
	}
	public void setNewsDao(NewsDao newsDao)
	{
		this.newsDao = newsDao;
	}

	public void save(News news)
	{
		this.newsDao.saveNews(news);
	}
	public List<News> findAll()
	{
		return this.newsDao.findAllNews();
	}
	public void delete(News news)
	{
		this.newsDao.deleteNews(news);
	}
	@Transactional(propagation=Propagation.SUPPORTS, readOnly=true)
	public News find(int id)
	{
		return this.newsDao.findById(id);
	}
	public void update(News news)
	{
		this.newsDao.updateNews(news);
	}
}
